import time

from selenium.webdriver.support.wait import WebDriverWait

from config import BACK_URL
from page.page_back_login import BackLoginPage
from tools import DriverTools


class TestBackLogin:
    def setup_method(self):
        self.driver = DriverTools.get_driver()
        # 输入网址
        self.driver.get(BACK_URL)
        # 输入手机号 密码 验证码.....
        self.backlogin = BackLoginPage(self.driver)

    def teardown_method(self):
        # 关闭浏览器
        DriverTools.quit_driver()

    def test_back_login(self):
        self.backlogin.back_login('admin', 'HM_2023_test', '8888')
        time.sleep(2)
        result = self.backlogin.get_success()
        print(result)
        assert 'admin' in result
        self.backlogin.get_shot('back_login.png')
    # def test_back_login_fail(self):
    #     self.backlogin.back_login('admin', 'HM_2023test', '8888')
    #     result = self.backlogin.gte_fell()
    #     print(result)
    #     assert '用户名/密码错误' in result
    #     self.backlogin.get_shot('back_login.png')


